CC = gcc
CFLAGS = -Wall -I./ModuleA -I./ModuleB
SRC = main.c
OBJ_DIR = RELEASE
EXE_DIR = BUILD

OBJ = $(addprefix $(OBJ_DIR)/, $(SRC:.c=.o))
EXE = $(addprefix $(EXE_DIR)/, Project_2)

.PHONY: all clean

all: $(EXE)

$(EXE): $(OBJ) RELEASE/function.o RELEASE/copy.o
	$(CC) $(CFLAGS) -o $@ $^

# 明确定义生成 RELEASE/function.o 的规则
RELEASE/function.o: ModuleA/function.c
	$(CC) $(CFLAGS) -c $< -o $@

# 明确定义生成 RELEASE/copy.o 的规则
RELEASE/copy.o: ModuleB/copy.c
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f $(OBJ) $(EXE) RELEASE/function.o RELEASE/copy.o

$(OBJ_DIR)/%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

